<?php //pack11class

class ObjectCardImage extends Module {

    public $image="noPhoto.gif";
    const FOLDER="photos/large/";
    public $navigation="";


    public function setup() {
        if($this->param) $this->image=$this->param;
        $this->setBody(self::FOLDER.$this->image);
        //$this->setBody("<img src='".self::FOLDER.$this->image."'/>");
    }

    public function addNavigation($buttons=ObjectCardImageNavigationButton::BOTH) {
        if($buttons==ObjectCardImageNavigationButton::BOTH) {
            $button=new ObjectCardImageNavigationButton(ObjectCardImageNavigationButton::PREVIOUS);
            $this->navigation.=Template::html($button);
            $button=new ObjectCardImageNavigationButton(ObjectCardImageNavigationButton::NEXT);
            $this->navigation.=Template::html($button);
        } else if($buttons==ObjectCardImageNavigationButton::PREVIOUS) {
            $button=new ObjectCardImageNavigationButton(ObjectCardImageNavigationButton::PREVIOUS);
            $this->navigation.=Template::html($button);
        } else {
            $button=new ObjectCardImageNavigationButton(ObjectCardImageNavigationButton::NEXT);
            $this->navigation.=Template::html($button);
        }
        $pdfFile=str_replace(".jpg", ".pdf", $this->image);
        if(is_file(ImageUploader::$pdfPath.$pdfFile)) {
            $this->navigation.="<a href='".ImageUploader::$pdfPath.$pdfFile."' target='_blank'><span class=\"PhotoOpener\"><img src='images/pdf.gif'><br/></span>".LabelManager::getLabel("save_pdf_label")."</a>";
        } else {
            $this->navigation.=str_replace('\"', '"', "<span class=\"PhotoOpener\" onClick=\"ZoomPhotoPopup.PhotoZoomer('".ImageUploader::$originalPath.$this->image."')\"><img src=\"images/zoom_photo.gif\"><br/>".LabelManager::getLabel("zoom_photo_label")."</span>");
            //$this->navigation.="<span onClick='PopupManager.open()'><img src='images/zoom_photo.gif'><br/>".LabelManager::getLabel("zoom_photo_label")."</span>";
        }
        

        /*
        if($buttons==ObjectCardImageNavigationButton::BOTH || $buttons==ObjectCardImageNavigationButton::PREVIOUS) {
            $button=new ObjectCardImageNavigationButton($buttons);
        }

        if($buttons==ObjectCardImageNavigationButton::BOTH || $buttons==ObjectCardImageNavigationButton::NEXT) {
            $button=new ObjectCardImageNavigationButton($buttons);
        }*/
        //$this->navigation.=Template::html($button);
    }

}
?>
